package com.bawei.lib_log.logger

import android.util.Log
import com.bawei.lib_log.ILogger
import com.bawei.lib_log.LoggerLevel

/**
 *作者：lxy
 *功能:
 *时间：2025/5/22
 */
class FileLogger : ILogger {
    private var isDebug = true
    private var TAG = ""
    private var level = LoggerLevel.Debug
    private var loggerFormat = "(:=>$TAG %s -->%s"  //%s占位符
    private var url = ""
    override fun d(tag: String, log: String) {
        if (isDebug && level.ordinal >= LoggerLevel.Debug.ordinal) {
//            Log.d(TAG,String.format(loggerFormat,tag,log))
        }
    }

    override fun v(tag: String, log: String) {
        if (isDebug && level.ordinal >= LoggerLevel.Verbose.ordinal) {
//            Log.v(TAG,String.format(loggerFormat,tag,log))
        }
    }

    override fun i(tag: String, log: String) {
        if (isDebug && level.ordinal >= LoggerLevel.Info.ordinal) {
//            Log.i(TAG,String.format(loggerFormat,tag,log))
        }
    }

    override fun w(tag: String, log: String) {
        if (isDebug && level.ordinal >= LoggerLevel.Warn.ordinal) {
//            Log.w(TAG,String.format(loggerFormat,tag,log))
        }
    }

    override fun e(tag: String, log: String) {
        if (isDebug && level.ordinal >= LoggerLevel.Error.ordinal) {
//            Log.e(TAG,String.format(loggerFormat,tag,log))
        }
    }

    override fun isDebug(isDebug: Boolean) {
        this.isDebug = isDebug
    }

    override fun setLogTAG(TAG: String) {
        this.TAG = TAG
    }

    override fun setLoggerLevel(level: LoggerLevel) {
        this.level = level
    }

    override fun setSaveUrl(url: String) {
        this.url = url
    }
}